function createPopUp(data, place) {
	//alert(data);
	//alert(popMargTop + " " + popMargLeft);
	
	$('.' + place).empty();
	$('.' + place).append(	"<div id=\"notification-box\" class=\"notification-popup\"> " +
								//"<a href=\"#\" class=\"close\"><img src=\"../assets/popup_close.png\" class=\"notification_close\" title=\"Close Window\" alt=\"Close\" /></a> " +
								"<div id=\"inside_border\"> " +
									"<div id=\"notification_title\">CONGRATULATION!</div> " +
									"<div id=\"notification_detail\"> " +
										"<div id=\"notification_detail_image\"> " +
											
										"</div> " +
										
										"<div id=\"notification_detail_text\"> " +
											
										"</div> " +
									"</div> " +
								"</div> " +
							"</div>");
							
	var popMargTop = ($('.wrap').height() - 500) / 2; 
	var popMargLeft = ($('.wrap').width() - 300) / 2; 
	
	if (data.substr(0,3) == "lvl") {
		$("#notification_detail_image").append("<img src=\"../assets/images/levelup.png\"/>");
		$("#notification_detail_text").append("Kamu berhasil naik ke <br /><h1>LEVEL " + data.substr(3) + " !</h1>");
	} else {
		$("#notification_detail_image").append("<img src=\"../assets/images/badges/" + data + ".png\"/>");
		$("#notification_detail_text").append("Kamu baru saja mendapatkan achievement <h1>" + getBadge_name(data).toUpperCase() + " !</h1>");
		
		localStorage.setItem("estudia_achievment_" + data, 1);
		
		$.get("http://estudiahapid.ap01.aws.af.cm/services/changeachievment.php?username=" + localStorage.getItem("estudia_user") + "&query=" + data, function(data) {
			var result = JSON.parse(data);
			
			if (result["status"] == "success") {
				//alert("success");
			} else {
				//alert("failed");
			}
		}).done(function (data) {

		});
		
	}
	
	$("#notification-box").css({ 
		'top' : popMargTop,
		'left' : popMargLeft
	});
	$('#notification-box').fadeIn(3000);
	
	// Add the mask to body
	$('body').append('<div id="mask"></div>');
	$('#mask').fadeIn(300);
	
	$(document).keyup(function(e) {
		if (e.keyCode == 27) { 
			$('#mask , .login-popup').fadeOut(300 , function() {
				$('#mask').remove();
				$('.' + place).empty();
			}); 
		}   // esc
	});
	
	$('.notification_close, #mask').click(function() { 
		$('#mask , .login-popup').fadeOut(300 , function() {
			$('#mask').remove();
			$('.' + place).empty();
		}); 
	
		return false;
	});
};

function getBadge_name(badge_id) {
	
	switch(badge_id) {
		case "b01":
			return "Motivated";
			break;
		case "b02":
			return "Novice Learner";
			break;
		case "b03":
			return "Lucky Guess";
			break;
		case "b04":
			return "Genius";
			break;
		case "b05":
			return "Study Oriented";
			break;
		case "b06":
			return "Hard Worker";
			break;
		case "b07":
			return "Grown Up";
			break;
		case "b08":
			return "Thirst of Knowledge";
			break;
		case "b09":
			return "Graduated";
			break;
		case "b10":
			return "Cum Laude";
			break;
		case "b11":
			return "Education Savior";
			break;
		default:
			return "undefined";
			break;
	}
	//return "alalalal";
};